<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>学生列表</title>
	<link rel="icon" href="img/favicon.ico" type="image/x-icon" />
	<link rel="stylesheet" type="text/css" href="../easyui-1.5.1/themes/icon.css" />
	<link rel="stylesheet" type="text/css" href="../easyui-1.5.1/themes/default/easyui.css" />
	<!-- <link rel="stylesheet" type="text/css" href="../easyui-1.5.1/demo/demo.css" /> -->
	<script type="text/javascript" src="../easyui-1.5.1/jquery.min.js"></script>
	<script type="text/javascript" src="../easyui-1.5.1/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="../easyui-1.5.1/locale/easyui-lang-zh_CN.js"></script>
	<script type="text/javascript" src="../easyui-1.5.1/plugins/datagrid-detailview.js"></script>
	<link rel="stylesheet" type="text/css" href="css/style.css" />
	<script type="text/javascript" src="js/list.js"></script>
</head>
<style>
.datagrid-header .datagrid-cell span {
    font-size: 15px;
    font-weight: bold;
}
</style>

<body class="easyui-layout" id="myLayOut">
	<div data-options="region:'north'"
		style="height: 98px; width: 100%; overflow: hidden">
		<div class="page_top">
			<div class="page_logo">
				<table width="100%" border="0" cellpadding="0" cellspacing="0" id="ta">
					<tr>
						<td width="56"></td>
						<td colspan="4" rowspan="2" width="80%">
							<table width="100%" border="0" cellspacing="0" cellpadding="0">
							<br/>
								<tr>
									<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
									<td style="font-size: 18px;"><img src="img/zrs.png" />总人数：&nbsp;<span id="zrs"></span>&nbsp;人
									&nbsp;&nbsp;&nbsp;&nbsp;<img src="img/ydrs.png" />已到：&nbsp;<span id="yd"></span>&nbsp;人
									&nbsp;&nbsp;&nbsp;&nbsp;<img src="img/yjzy.png" />已交作业：&nbsp;<span id="yjzy"></span>&nbsp;人</td>
									<td>
										<img src="img/sz.png" />
										<span id="dateSpan" style="font-size: 18px;"></span>
									</td>	
								</tr>
									
							</table>
						</td>
					</tr>
					<tr>
						<td width="56"><img src="img/logo.png" width="306"
							height="64" align="middle" /></td>
					</tr>
				</table>
			</div>
			<div class="page_dh">
				<div class="page_user">
					<table>
						<tr>
							<td id="username">当前用户：<img src="img/dqyh.png">admin</td>
						</tr>
					</table>
				</div>
				<div class="page_nav">
					<ul class="nav">
						<li style="float:left;margin-left: 5px;"><img src="img/xslb.ico" />学生列表</li>
						<li style="float:left;margin-left: 5px;"><img src="img/remove.png" />
							<a onclick="deleteAll()">清除学生数据</a></li>
						<li style="float:left;margin-left: 5px;"><img src="img/remove.png" />
							<a onclick="deleteOld()">清除上节课数据</a></li>
						<li style="float:right;margin-right: 10px;"><img src="img/dc.png" /> <a
							onclick="upload()">上传任务书</a></li>
					</ul>
				</div>
			</div>
		</div>
	</div>

	<div data-options="region:'center'" style="width:75%">
		<div class="easyui-layout" data-options="fit:true">
			 <table id="dgg" class="easyui-datagrid"
			 data-options="fitColumns:true,
			 			url:'list_json.do',
			 			method:'get',
			 			dataType:'json',
			 			pagination:true,
			 			toolbar:'#toolbar',
			 			rownumbers:true,
			 			singleSelect:true,
			 			pageSize:40,
			 			pageList:[20,40,60],
			 			fit:true"
				>
				<thead>
					<tr>
						<th data-options="field:'uid',width:80,align:'center',sortable:true" >学号</th>
						<th data-options="field:'username',width:50,align:'center',sortable:true">用户名</th>
						<th data-options="field:'stats',width:40,align:'center',sortable:true,formatter:formatkao">考勤</th>
						<th data-options="field:'computername',width:100,align:'center',sortable:true">电脑名</th>
						<th data-options="field:'homework',width:40,align:'center',sortable:true,formatter:formathomework">作业</th>
						<th data-options="field:'good',width:80,align:'center',formatter:formatgood">奖励</th>
						<th data-options="field:'cz',width:120,align:'center',formatter:formatcontrol">操作</th>
					</tr>
				</thead>
			</table>
		</div>
		<div id="toolbar" style="padding:5px 0;">
			<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload'" onclick="sx()" style="width:120px;height:35px;margin-left:5px;">刷新</a>
			<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add'" onclick="importt()" style="width:120px;height:35px;margin-left:5px;">导入学生数据</a>
			<a href="exportemp" class="easyui-linkbutton" data-options="iconCls:'icon-remove'" style="width:120px;height:35px;margin-left:20px;">导出学生模板</a>
			<a href="downloadzip2" class="easyui-linkbutton" data-options="iconCls:'icon-remove'" style="width:120px;height:35px;margin-right:50px;float:right;">导出学生作业</a>
			<a href="exportxls" class="easyui-linkbutton" data-options="iconCls:'icon-remove'" style="width:120px;height:35px;margin-right:20px;float:right;">导出学生数据</a>
			
		</div>
	</div>

	<div data-options="region:'east',title:'任务书列表'"  style="width: 25%;">
		<table id="ren" class="easyui-datagrid"
			 data-options="fitColumns:true,
			 		url:'getfiles.do',
			 		method:'get',
			 		dataType:'json',
			 		rownumbers:true,
			 		singleSelect:true,
			 		fit:true">
			<thead>
				<tr>
					<th data-options="field:'id',width:80,align:'center',hidden:true" >编号</th>
					<th data-options="field:'material',width:100,align:'center',formatter:xiazaiMaterial">资料</th>
					<th data-options="field:'cz',width:20,align:'center',formatter:format_meterial_btn">操作</th>
				</tr>
			</thead>
		</table>
	</div>

	<div data-options="region:'south',title:'版本所有',collapsible:false" style="height: 67px;">
		<h2 style="font-family: '微软雅黑,楷体';text-align:center;padding:0 5px;margin-top: 10px;word-spacing:12px;">指导老师:周湛樟 EasyUI框架:黄纯锡 Bootstrap:何景超 后端:张坤明  特别鸣谢：广州市白云工商技师学院
		</h2>
			
	</div>
	
	<!-- 清除学生数据窗体 -->
	<div id="windeleteAll" class="easyui-window" title="清除学生数据"
		style="width: 300px; height: 180px; display: table;"
		data-options="maximizable:false,closed:true,iconCls:'icon-save',modal:true" align="center">
			<form id="qcxssj" style="text-align: center;">
				<h1>
					<span class="log-in">请输入清除密码！！！</span>
				</h1>
				<p>
					<input type="password" name="pwd" id="pwd" style="margin-top: 10px; margin-left: 1px; font-size: 20px; text-align: center;	"  />
				</p> 
				<p>
					<a type="button" class="easyui-linkbutton" data-options="iconCls:'icon-ok'" style="margin:20px 0px;width: 85%; height: 40px;" onclick="deleteall()">提交</a>
				</p>
			</form>
	</div>
	
	<div id="windeleteOld" class="easyui-window" title="清除学生数据"
		style="width: 300px; height: 180px; display: table;"
		data-options="maximizable:false,closed:true,iconCls:'icon-save',modal:true" align="center">
			<form id="qcsjk" style="text-align: center;">
				<h1>
					<span class="log-in">请输入清除密码！！！</span>
				</h1>
				<p>
					<input type="password" name="pwd1" id="pwd1" style="margin-top: 10px; margin-left: 1px; font-size: 20px; text-align: center;	"  />
				</p> 
				<p>
					<a type="button" class="easyui-linkbutton" data-options="iconCls:'icon-ok'" style="margin:20px 0px;width: 85%; height: 40px;" onclick="deleteold()">提交</a>
				</p>
			</form>
	</div>
	
	<!-- 上传本节课任务书窗体 -->
	<div id="winupload" class="easyui-window" title="上传本节课任务书"
		style="width: 500px; height: 180px; display: table;"
		data-options="maximizable:false,closed:true,iconCls:'icon-save',modal:true"
		align="center">
		<form id="scrws" enctype="multipart/form-data">
			<h1 style="margin-left: 5px;">
				<span class="log-in">请上传</span>
			</h1>
			<p>
				<input type="file" name="attachs" id="attachs"
					style="margin-top: 10px; margin-left: 5px; font-size: 20px" /> <a
					type="button" class="easyui-linkbutton"
					data-options="iconCls:'icon-add'" id="btn">添加</a>
			</p>
			<div id="files"></div>
			<p>
				<a type="button" class="easyui-linkbutton"
					data-options="iconCls:'icon-ok'"
					style="margin: 20px 20px; width: 90%; height: 40px"
					onclick="uploadMaterial()">提交</a>
			</p>
		</form>
	</div>
	<!-- 导入学生数据窗体 -->
	<div id="winimportt" class="easyui-window" title="导入学生数据"
		style="width: 500px; height: 250px;"
		data-options="maximizable:false,closed:true,iconCls:'icon-save',modal:true"
		align="center">
		<form id="ff" enctype="multipart/form-data"
			style="padding: 30px 60px;">
			<div style="margin-bottom: 40px">
				<input class="easyui-filebox" id="attach" name="attach"
					data-options="prompt:'请导入学生数据的EXCEL文件',buttonText:'&nbsp;选&nbsp;择&nbsp;',required:true,label:'请导入学生数据的EXCEL文件', labelPosition:'top'"
					style="width: 100%">
			</div>
			<div>
				<a href="#" class="easyui-linkbutton"
					data-options="iconCls:'icon-ok'" onclick="ImportExcel()"
					style="width: 100%">提交</a>
			</div>
		</form>
	</div>

	<script type="text/javascript">
		//执行任务书添加循环窗口
		$(function() {
			$('#btn')
					.click(
							function() {
								var field = "<p><input type='file' name='attachs' id='attachs' style='margin-top: 10px; margin-left: 1px; font-size: 20px' /><input type='button' style='margin-left: 5px;width: 50px;height: 25px;font-size: 15px;cursor: Pointer;' value='删除' onclick='removed(this);'/></p>";
								$('#files').append(field);
							});

			$('#winupload').window({
				onBeforeClose : function() {
					$('#files').html("");
				}
			});
			$('#winimportt').window({
				onBeforeClose : function() {
					$('#attach').html("");
				}
			});
			$('#windeleteAll').window({
				onBeforeClose : function() {
					$('#pwd').html("");
				}
			});
		});
		function removed(o) {
			$(o).parent().remove();
		}

		//执行系统时间
		
		function showtime() {
			var myDate = new Date(); //获取系统当前的时间
			var hour = myDate.getHours(); //得到当前时间小时  时
			var mm = myDate.getMinutes(); //得到当前时间分钟  分
			var sec = myDate.getSeconds(); //得到当前时间秒  秒
			var myhour = '';
			if (hour > 12) {
				myhour = '下午' + (hour - 12);
			} else {
				myhour = '上午' + hour;
			}
			var dateStr = myhour + " 时 " + mm + " 分 " + sec + " 秒";
			document.getElementById("dateSpan").innerHTML = dateStr;
		}
		//每隔1秒刷新一次  显示在页面上的时间
		setInterval("showtime();", 1000);

		//执行打开窗口
		function upload() {
			$("#winupload").panel('open');
		}

		function importt() {
			$("#winimportt").window("open");
		}
		
		function deleteAll() {
			$("#windeleteAll").window("open");
		}
		function deleteOld() {
			$("#windeleteOld").window("open");
		}
		$('#dgg').datagrid(
				{
					view : detailview,
					detailFormatter : function(index, row) {
						return '<div style="padding:10px;"><table id="ddv-' + index
								+ '"></table></div>';
					},
					onExpandRow : function(index, row) {
						getItemDetail(index, row);
					},
					onLoadSuccess : function() {
						// 加载完数据关闭等待的div
						updateTotal();
					}
				});
		function getItemDetail(index, row) {
			$('#ddv-' + index).datagrid({
				url : 'getwork.do?uid=' + row.uid,
				method : 'get',
				fitColumns : true,
				singleSelect : true,
				rownumbers : true,
				idField : 'uid',
				columns : [ [ {
					field : 'fileName',
					title : '作业名',
					width : 200,
					formatter : function(value, row, index){
						return '<a href="javascript:downloadHomeWork(\''+row.id+'\')">' + value + '</a>';
					}
				}, {
					field : 'fileSize',
					title : '文件大小',
					width : 40,
					formatter : function(value, row, index){
						return value + 'K';
					}
				}, {
					field : 'uploadTime',
					title : '上交时间',
					width : 100
				} ] ],
				onResize : function() {
					$('#dgg').datagrid('fixDetailRowHeight', index);
				},
				onLoadSuccess : function() {
					setTimeout(function() {
						$('#dgg').datagrid('fixDetailRowHeight', index);
					}, 0);
				}
			});
		}
	
	</script>
</body>

</html>